//二次封装接口
const app = getApp()
module.exports = (url, data, method = "GET", header = {}) => {
  wx.showLoading({
    title: 'Loading...',
    mask:true
  })
  return new Promise((resolve, reject) => {
    wx.request({
      //完成地址拼接
      url: app.config.apiBase + url,//读全局变量 +具体地址
      data,
      header,
      method,
      dataType: "json",
      success: resolve,
      fail: reject,
      //wx.request方法最后一定会执行的
      complete: wx.hideLoading
    })
  })
}